# 通过add_done_callback()回调
import asyncio


def my_callback(future):
    print('返回值：', future.result())


async def coroutine_example():
    await asyncio.sleep(1)
    return '这是一个结果'


coro = coroutine_example()
loop = asyncio.get_event_loop()
task = loop.create_task(coro)
task.add_done_callback(my_callback)
loop.run_until_complete(task)
loop.close()
